package vivo.com.foolishbar.core.warp.page;

import com.google.inject.AbstractModule;
import com.wideplay.warp.Warp;
import com.wideplay.warp.WarpModule;
import com.wideplay.warp.jpa.JpaUnit;
import com.wideplay.warp.persist.PersistenceService;
import com.wideplay.warp.persist.UnitOfWork;

public class FoolishBarCoreModule implements WarpModule {

	public void configure(Warp warp) {
		warp.install(PersistenceService.usingJpa().across(UnitOfWork.TRANSACTION).buildModule());

		warp.install(new AbstractModule() {
			protected void configure() {
				bindConstant().annotatedWith(JpaUnit.class).to("blogJpaUnit");
			}
		});

		warp.addStartupListener(BlogStartupListener.class);
		warp.addShutdownListener(BlogShutdownListener.class);
	}
}
